package com.zhouheng.module.multipledatasource.master.controller;


import com.zhouheng.module.multipledatasource.master.dao.MasterMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * masterController
 * 测试多数据源切换，跳过service层
 *
 * @author 周恒
 * @date 20180830 16:24:47
 * @since v1.0
 */
@RestController
@RequestMapping("/master")
public class MasterController {

    private static final Logger LOGGER = LoggerFactory.getLogger(MasterController.class);

    private MasterMapper masterMapper;

    public MasterController(MasterMapper masterMapper) {
        this.masterMapper = masterMapper;
    }

    @RequestMapping("/query")
    public String getMaster(){
        String result = masterMapper.selectByPrimaryKey(1).toString();
        LOGGER.info("查询master,result=[{}]",result);
        return result;

    }

}
